package com.itheima.day11andIO流;

import java.io.*;

/*2、【编号：1802】请使用缓冲流将D盘下的某个音频或者视频文件，
拷贝到当前模块目录下，并计算拷贝过程消耗的时间，
将时间（单位毫秒）打印到控制台。*/
public class Demo2 {
    public static void main(String[] args) throws IOException {
        BufferedOutputStream bos = new BufferedOutputStream(
                new FileOutputStream("JavaSEhHomeWork\\java.mp4"));
        BufferedInputStream bis = new BufferedInputStream(
                new FileInputStream("D:\\itcast\\java.mp4"));
        byte[] bys = new byte[1024 * 1024];
        int len;
        long start = System.currentTimeMillis();
        while ((len = bis.read(bys)) != -1) {
            bos.write(bys, 0, len);
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);
        bis.close();
        bos.close();
    }
}
